﻿using System;

namespace PPClasses
{
    /// <summary>
    /// 2D Vector
    /// </summary>
    [Serializable]
    public class Portal
    {
        public double X { get; set; }
        public double Y { get; set; }

        public Portal()
        {
        }

        public Portal(double x, double y)
        {
            X = x;
            Y = y;
        }

        public Portal(Portal o)
        {
            X = o.X;
            Y = o.Y;
        }

        public static Portal operator -(Portal a, Portal b)
        {
            return new Portal(a.X - b.X, a.Y - b.Y);
        }

        public double DistanceTo(Portal o)
        {
            double xx = o.X - this.X;
            xx = xx * xx;
            double yy = o.Y-this.Y;
            yy = yy * yy;
            return Math.Sqrt(xx + yy);
        }

        /// <summary>
        /// Cross Product
        /// </summary>
        public double cross(Portal other)
        {
            return X * other.Y - Y * other.X;
        }
    }
}
